//
//  CHDLeadVC.m
//  IOSWeiiPhoneNews
//
//  Created by ibokan on 14-4-23.
//  Copyright (c) 2014年 chen. All rights reserved.
//

#import "CHDLeadVC.h"
#import "CHDMainTableBarVC.h"
#define SCREEN_WIDTH [UIScreen mainScreen].bounds.size.width
#define SCREEN_HEIGHT [UIScreen mainScreen].bounds.size.height
@interface CHDLeadVC ()

@end

@implementation CHDLeadVC

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    UIScrollView *scrollView = [[UIScrollView alloc]initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT)];
    scrollView.contentSize = CGSizeMake(SCREEN_WIDTH*5, SCREEN_HEIGHT);
    //是否能翻页
    scrollView.pagingEnabled = YES;
    //7.0新特性 自动布局
    scrollView.showsHorizontalScrollIndicator = NO;
    for (int i=0; i<5; i++) {
        UIImageView *imgView = [[UIImageView alloc]initWithFrame:CGRectMake(i*SCREEN_WIDTH, 0, SCREEN_WIDTH, SCREEN_HEIGHT)];
        NSString *img = [NSString stringWithFormat:@"start_%d.jpeg",i+1];
        imgView.image = [UIImage imageNamed:img];
        [scrollView addSubview:imgView];
        
        if (i==4) {
            UIButton *startBtn = [UIButton buttonWithType:UIButtonTypeRoundedRect];
            startBtn.frame = CGRectMake(98, SCREEN_HEIGHT-96, 124, 50);
            //            startBtn.backgroundColor = [UIColor redColor];
            [startBtn addTarget:self action:@selector(startAction) forControlEvents:UIControlEventTouchUpInside];
            [imgView addSubview:startBtn];
            //用户交互
            imgView.userInteractionEnabled = YES;
        }
    }
    [self.view addSubview:scrollView];

}
-(void)startAction{
    [self presentViewController:[CHDMainTableBarVC new] animated:YES completion:nil];
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
